﻿import com.gamepackage.events.*;
import com.gamepackage.tilemap.*;
import com.gamepackage.tilemap.layer.*;

class com.gamepackage.tilemap.layer.Capture
{
	private var layer: Layer;
	private var sprite: Sprite;
	
	function Capture( layer: Layer )
	{
		this.layer = layer;
	}
	
	function adopt( sprite: Sprite ): Void
	{
		this.sprite = sprite;
		
		new Thread( this , run ).start();
	}
	
	function run( Void ): Void
	{
		//-- DUMMY IMPLEMENTATION --//
		var sx = sprite.getX() - 80;
		if( sx < 0 ) sx = 0;
		
		var ly = layer.getY();
		var ty = (( sprite.getY() <= 192 ) ? 0 : 12 ) * 16;
		
		layer.moveTo( sx , ty )
	}
}